/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 *
 * @author bienphongvnn
 */
public class ConnectionProvider {
    public static Connection Connect(){
        try{
            String driver = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://localhost:3306/";
            String username = "root";
            String password = "123456";
            String dbName = "quanlyduongsat";
            Class.forName(driver);
            Connection conn = DriverManager.getConnection(url + dbName, username, password);
            return conn;
        }
        catch(Exception ex){
            System.out.println(ex.getMessage());
            return null;
        }
    }
}
